package com.NeuglsWorkStudio.UI.Dialog
{
	import com.NeuglsWorkStudio.Colors.ColorUtility;
	import com.NeuglsWorkStudio.UI.FormElement.Component.TLabel;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TLabelConfig;
	import com.NeuglsWorkStudio.UI.GradientBar;
	
	import flash.display.Sprite;
	import flash.filters.DropShadowFilter;
	
	public class TToastNotifier extends Sprite
	{
		private var _FBaseColor:int;
		private var _FHeight:Number;
		private var _FWidth:Number;
		private var _FMsg:String;
		private var _FBar:GradientBar;
		private var _FText:TLabel;
		private	var ExtraBarWidth:Number=30;
		
		public function TToastNotifier(BaseColor:int,H:Number,Msg:String)
		{
			super();
			
			_FBaseColor=BaseColor;
			_FHeight=H;
			_FMsg=Msg;
			
			Init();
			Paint();
		}
		
		private function Init():void{
			
			var LabelConfig:TLabelConfig=new TLabelConfig();
			LabelConfig.AutoWordWrap=false;
			LabelConfig.Caption=_FMsg;
			LabelConfig.Color=ColorUtility.GetColorFromBaseColor(_FBaseColor);
			LabelConfig.Font='Tahoma';
			LabelConfig.Height=18;
			LabelConfig.Name='labelmsg';
			LabelConfig.Size=16;
			
			_FText=new TLabel(LabelConfig);
			
			_FBar=new GradientBar(_FBaseColor,_FText.width+ExtraBarWidth,_FHeight,true,_FHeight*3/5,null,false);
			_FBar.filters=[new DropShadowFilter(0,0,0x222222,0.9,30,30)];
			_FBar.alpha=0.8;
			this.addChild(_FBar);
			this.addChild(_FText);
		}
		
		protected function Paint():void{
			with(_FText){
				x=(_FBar.Width-width)/2;
				y=(_FBar.Height-height)/2;
			}
		}
	}
}